#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;

int a[64];
ll dp[64][64][64];
ll dfs(int pos,int num0,int num1,bool lead,bool limit)
{
    if(pos==-1)
    {
        return num0>=num1;
    }

    if(!limit&&dp[pos][num0][num1]!=-1)return dp[pos][num0][num1];

    ll tmp=0;
    int up=limit ? a[pos] : 1;//找上限
    for(int i=0; i<=up; i++)
    {
        tmp+=dfs(pos-1,num0+(i==0&&!lead),num1+(i==1),lead&&i==0,limit&&i==up);
    }

    if(!limit&&!lead)dp[pos][num0][num1]=tmp;
    return tmp;
}
ll solve(ll n)
{
    int pos=0;
    while(n)
    {
        a[pos++]=n&1;
        n>>=1;
    }
    return dfs(pos-1,0,0,true,true);
}
int main()
{
    ll n,m;
    while(scanf("%lld%lld",&n,&m)!=EOF)
    {
        memset(dp,-1,sizeof(dp));
        printf("%lld\n",solve(m)-solve(n-1));
    }
    return 0;
}